<?php
declare(strict_types=1);
namespace Kanin\Games\lib;
use Kanin\MyTools\KMongo;
use Swoole\ConnectionPool;
/**
 * @method KMongo get()
 * @method void put(KMongo $connection)
 */
class MongoPool extends ConnectionPool{

	protected $config;

	public function __construct($config, int $size = self::DEFAULT_SIZE)
	{
		$this->config = $config;
		parent::__construct(function () {
			return new KMongo($this->config['host'], $this->config['port'], $this->config['username'], $this->config['password']);
		}, $size);
	}
}